#!/usr/bin/env node

const log = console.log,
      user = process.argv[2],
      pwd = process.argv[3];

//判断命令行参数
if(process.argv.length !== 4){
  console.error('命令行格式：cmd user_name password');
  process.exit(1);
}

log('user name:\n',user);
log('password:\n',pwd);

//拼接用户名和密码，用：分割
const buffer = Buffer.from(user + ':' + pwd);
//转化成base64编码
log('Base64:', buffer.toString('Base64'));
